package com.demo;


public class OverrideDemo {

  public static void main(String[] args) {
    Father father = new Son();
    father.sayHello();

  }
}

class Father {


  public void sayHello() {
    System.out.println("Hello,I am father!");
  }
}

class Son extends Father {

  @Override
  public void sayHello() {
    System.out.println("Hello,I am son!");
  }

  /**报错了，因为该方法不是从父类继承过来的
   /*@Override
   public void sayHellos() {
   System.out.println("Hello,I am son!");
   }*/
}
